﻿<common:LayoutAwarePage
    x:Name="pageRoot"
    x:Class="CC98.Metro.Pages.Account.Authentication"
    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
    IsTabStop="false"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:CC98.Metro.Pages.Account"
    xmlns:common="using:CC98.Metro.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
    
    <Grid Style="{StaticResource LayoutRootStyle}">
        <Grid.RowDefinitions>
            <RowDefinition Height="140"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!-- Back button and page title -->
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button x:Name="backButton" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}"/>
            <TextBlock x:Uid="Authentication"  x:Name="pageTitle" Text="Authentication" Style="{StaticResource PageHeaderTextStyle}" Grid.Column="1"/>
        </Grid>
        
        <!-- Login Panel -->
        <Grid HorizontalAlignment="Center" Grid.Row="1" VerticalAlignment="Center" MinWidth="400" Margin="0,0,0,150">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>

            <TextBlock x:Uid="Username" Text="Username" Grid.Row="0" Grid.Column="0" Style="{StaticResource BasicTextStyle}" Margin="0,0,0,5" />
            <TextBox Grid.Row="0" Grid.Column="1" Margin="0,0,0,5" Text="{Binding username}" />

            <TextBlock x:Uid="Password" Text="Password" Grid.Row="1" Grid.Column="0" Style="{StaticResource BasicTextStyle}" Margin="0,0,0,5" />
            <PasswordBox Grid.Row="1" Grid.Column="1" Margin="0,0,0,5" Password="{Binding password}" />

            <CheckBox x:Uid="ChkRememberMe" Content="Remember me" Grid.Row="2" Grid.ColumnSpan="2" IsChecked="{Binding isRememberMe, Mode=TwoWay}" />
            <CheckBox x:Uid="ChkSavePassword" Content="Save password" Grid.Row="3" Grid.ColumnSpan="2" IsChecked="{Binding isSavePassword, Mode=TwoWay}" />

            <StackPanel Orientation="Horizontal" Grid.Row="4" Grid.ColumnSpan="2" HorizontalAlignment="Right">
                <Button x:Uid="BtnLogin" x:Name="btnLogin" Content="Login" Click="btnLogin_Click" />
                <Button x:Uid="BtnReset" x:Name="btnReset" Content="Reset" Click="btnReset_Click" />
            </StackPanel>
        </Grid>
        
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="ApplicationViewStates">
                <VisualState x:Name="FullScreenLandscape"/>
                <VisualState x:Name="Filled"/>
                <VisualState x:Name="FullScreenPortrait" />
                <VisualState x:Name="Snapped" />
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</common:LayoutAwarePage>
